package com.tql.view.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("view");
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/index.html").setViewName("index");
        registry.addViewController("/success").setViewName("success");
        registry.addViewController("/success.html").setViewName("success");
    }
/*
* 配置图片资源映射
*
* */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/action/**").addResourceLocations("file:/E:/view/action/");
        registry.addResourceHandler("/lastnew/**").addResourceLocations("file:/E:/view/lastnew/");
        registry.addResourceHandler("/animal/**").addResourceLocations("file:/E:/view/animal/");
        registry.addResourceHandler("/anime/**").addResourceLocations("file:/E:/view/anime/");
        registry.addResourceHandler("/scenery/**").addResourceLocations("file:/E:/view/scenery/");
        registry.addResourceHandler("/beauty/**").addResourceLocations("file:/E:/view/beauty/");
        registry.addResourceHandler("/galaxy/**").addResourceLocations("file:/E:/view/galaxy/");
        registry.addResourceHandler("/game/**").addResourceLocations("file:/E:/view/game/");
        registry.addResourceHandler("/phone/**").addResourceLocations("file:/E:/view/phone/");
        registry.addResourceHandler("/image/**").addResourceLocations("file:/E:/view/image/");
        registry.addResourceHandler("/")
                .addResourceLocations("classpath:/static/**")
        ;
    }
}
